package com.gym.code.generator.impl;

import com.gym.code.generator.impl.bean.BeanFileGenerator;
import com.gym.code.generator.impl.dao.DaoFaceFileGenerator;
import com.gym.code.generator.impl.dao.DaoImplFileGenerator;
import com.gym.code.generator.impl.service.ServiceFaceFileGenerator;
import com.gym.code.generator.impl.service.ServiceImplFileGenerator;
import com.gym.code.generator.model.mapping.ModuleGenerateModel;

/**
 * 针对一个模块（table）提供的信息，生成代码
 * @author xinchun.wang 
   @email: 532002108@qq.com
 * @createTime 2015-4-19 下午12:56:47
 */
public class ModuleGenerator {
	
	private static ModuleGenerator instance = new ModuleGenerator();
	
	private ModuleGenerator(){}
	
	public static ModuleGenerator getInstance(){
		return instance;
	}

	private static BeanFileGenerator beanFileGenerator = BeanFileGenerator.getInstance();

	private static DaoImplFileGenerator daoImplFileGenerator = DaoImplFileGenerator.getInstance();

	private static DaoFaceFileGenerator daoFaceGenerator = DaoFaceFileGenerator.getInstance();
	
	private static ServiceFaceFileGenerator serviceFaceFileGenerator = ServiceFaceFileGenerator.getInstance();

	private static ServiceImplFileGenerator serviceImplFileGenerator = ServiceImplFileGenerator.getInstance();
	
	public void generate(ModuleGenerateModel model) {
		beanFileGenerator.generate(model.getBeanGenerateModel());
		daoFaceGenerator.generate(model.getDaofaceModel());
		daoImplFileGenerator.generate(model.getDaoLayerGenerateModel());
		
		serviceFaceFileGenerator.generate(model.getServiceFaceModel());
		serviceImplFileGenerator.generate(model.getServiceLayerGenerateModel());
		// model.getServiceLayerGenerateModel();
	}

}
